<?php

namespace app\admin\model\general;

use think\Model;


class VipConfig extends Model
{

    

    

    // 表名
    protected $table = 'vip_config';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'vip_type_text',
        'is_trial_text'
    ];
    

    
    public function getVipTypeList()
    {
        return ['0' => __('Vip_type 0'), '1' => __('Vip_type 1')];
    }

    public function getIsTrialList()
    {
        return ['0' => __('Is_trial 0'), '1' => __('Is_trial 1')];
    }


    public function getVipTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['vip_type']) ? $data['vip_type'] : '');
        $list = $this->getVipTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getIsTrialTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['is_trial']) ? $data['is_trial'] : '');
        $list = $this->getIsTrialList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
